<template>
    <div class="evection-task">
        <my-breadcrumb :breadcrumb="['我的任务','出差审批']"/>
        <el-table :data="taskData">
            <el-table-column label="出差原由" prop="description"/>
            <el-table-column label="出差开始日期" prop="beginDate"/>
            <el-table-column label="出差结束日期" prop="endDate"/>
            <el-table-column label="出差天数" prop="num"/>
            <el-table-column label="发起人" prop="startEmp.empName"/>
            <el-table-column label="操作">
                <template #default="s">
                    <el-button type="primary" plain @click="handleClick(s.row)">处理</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
    <evection-task-handle ref="taskHandleRef" @refresh-data="loadEvectionTask"/>
</template>

<script>
import {queryMyEvectionTask} from "../../../../network/process/evection-process";
import EvectionTaskHandle from "./EvectionTaskHandle.vue";
import MyBreadcrumb from "../../../../components/MyBreadcrumb.vue";

export default {
    name: "EvectionTask",
    components: {EvectionTaskHandle,MyBreadcrumb},
    data(){
        return {
            taskData: [
                // {
                //     "num": 8,
                //     "description": "哔哔叭叭",
                //     "beginDate": "2022-05-29",
                //     "endDate": "2022-05-29",
                //     "processInstanceId": "0c85bfba-df67-11ec-b68b-00ff37603673",
                //     "taskId": "0c8d11c7-df67-11ec-b68b-00ff37603673",
                //     "startEmp": {
                //         "id": 11,
                //         "empName": "王思龙",
                //     }
                // }
            ]
        }
    },
    methods: {
        handleClick(row){
            let ref = this.$refs.taskHandleRef;
            ref.visible = true;
            ref.task = row;
            ref.auditResult.taskId = row.taskId;
        },
        loadEvectionTask(){
            let userId = this.$store.state.loginUser.id;
            queryMyEvectionTask(userId).then(vo=>{
                this.$response.handle({
                    data: vo,
                    successFn: ()=>{
                        this.taskData = vo.data;
                    },
                    log: '我的出差审批任务'
                })
            })
        }
    },
    created() {
        this.loadEvectionTask();
    }
}
</script>

<style scoped>
*{
    /*border: 1px solid red;*/
}
.evection-task{
    height: 99%;
    background: white;
}
</style>